home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 114 / macaddict114.cdr / Software / Utilities / macam.0.8.4.dmg / macam sources / utilities / GlobalDefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-11-16  |  4.6 KB  |  119 lines

  1. /*
  2.     macam - webcam app and QuickTime driver component
  3.     Copyright (C) 2002 Matthias Krauss (macam@matthias-krauss.de)
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     $Id: GlobalDefs.h,v 1.7 2005/09/29 18:52:47 hxr Exp $
  20. */
  21.  
  22. /*
  23. This is the global definitions file. It includes some compiling options, some convenience macros and some common enumerations / names for things. I include this file in EVERY HEADER FILE. This has the downside of having to recompile everything when something is changed here, but it's for sure that the options are available everywhere.
  24. */
  25.  
  26.  
  27. #ifndef _GLOBALDEFS_
  28. #define _GLOBALDEFS_
  29.  
  30. typedef enum WhiteBalanceMode {
  31.     WhiteBalanceLinear        = 1,
  32.     WhiteBalanceIndoor        = 2,
  33.     WhiteBalanceOutdoor        = 3,
  34.     WhiteBalanceAutomatic     = 4
  35. } WhiteBalanceMode;
  36.  
  37. typedef enum CameraResolution {
  38.     ResolutionInvalid = 0,    //Indicates a wrong or not applicable resolution
  39.     ResolutionSQSIF = 1,    //sqsif = 128 x  96
  40.     ResolutionQSIF  = 2,    //qsif  = 160 x 120
  41.     ResolutionQCIF  = 3,    //qcif  = 176 x 144
  42.     ResolutionSIF   = 4,    //sif   = 320 x 240
  43.     ResolutionCIF   = 5,    //cif   = 352 x 288
  44.     ResolutionVGA   = 6,    //vga   = 640 x 480
  45.     ResolutionSVGA  = 7        //svga  = 800 x 600
  46. } CameraResolution;
  47.  
  48. typedef enum CameraError {
  49.     CameraErrorOK        = 0,    //Everything's fine
  50.     CameraErrorBusy        = 1,    //Access to device denied - probably already in use somewhere else
  51.     CameraErrorNoPower        = 2,    //Not enough usb power to use device (there's also an independent system alert)
  52.     CameraErrorNoCam        = 3,    //No camera found
  53.     CameraErrorNoMem        = 4,    //Some memory allocation failed
  54.     CameraErrorNoBandwidth    = 5,    //The usb data bandwidth would be exceeded
  55.     CameraErrorTimeout        = 6,    //Failed to maintain the data stream in time
  56.     CameraErrorUSBProblem    = 7,    //An important USB command failed for no known reason
  57.     CameraErrorUnimplemented    = 8,    //A feature that is not (yet) implemented
  58.     CameraErrorInternal        = 9    //Some other, probably serious, error
  59. } CameraError;
  60.  
  61. typedef enum ColorMode {
  62.     ColorModeColor        = 1,
  63.     ColorModeGray        = 2
  64. } ColorMode;
  65.  
  66.  
  67. //Global build settings. Comment unwanted stuff out
  68.  
  69. #define VERBOSE 1
  70.  
  71. //#define REALLY_VERBOSE 1
  72.  
  73. /*
  74. malloc/free tracking: Since I sometimes have to do "remote debugging" (send the code to someone else and ask what happens), I cannot use elaborate tools there. So I use macros for malloc and free so we can switch on memory logging to the console. The testers then can send the console log back. To switch on or off, uncomment or comment the next #define statement.
  75. */
  76.  
  77. //#define LOG_MEM_CALLS 1
  78.  
  79. /*
  80.  QuickTime call tracking. It's sometimes interesting to see what kinds of calls the clients of the QuickTime Component actually do and in which order. So this opens the opportunity to log all calls to the console. To switch on or off, uncomment or comment the next #define statement.
  81.  */
  82.  
  83. //#define LOG_QT_CALLS 1
  84.  
  85. /*
  86. USB control tracking. Another sometimes interesting thing is to track the sequence of USB commands passed to the device. To switch on or off, uncomment or comment the next #define statement. Please note that this is still being incorporated into the code so not all USB commands may be logged yet.
  87.  */
  88.  
  89. //#define LOG_USB_CALLS 1
  90.  
  91. //Some convenience macros
  92.  
  93. #ifdef LOG_MEM_CALLS
  94. #define MALLOC(ptr,type,size,msg) { NSLog(@"malloc: %s",(msg)); ptr=(type)malloc(size); NSLog(@"malloc result: %d",((int)(ptr))); }
  95. #define FREE(ptr,msg) { NSLog(@"free: %s %d",(msg),(ptr)); free(ptr); NSLog(@"free done"); }
  96. #else
  97. #define MALLOC(ptr,type,size,msg) ptr=(type)malloc(size)
  98. #define FREE(ptr,msg) free(ptr)
  99. #endif
  100.  
  101. #ifndef MAX
  102. #define MAX(a,b) (((a)>(b))?(a):(b))
  103. #endif
  104.  
  105. #ifndef MIN
  106. #define MIN(a,b) (((a)<(b))?(a):(b))
  107. #endif
  108.  
  109. #define CLAMP(a,b,c) (MIN(MAX(a,b),c))
  110.  
  111. //A shortcut for localization
  112. #define LStr(a) NSLocalizedString(a,NULL)    
  113.  
  114. // This was only defined in 10.4, and is needed for compilation on previous systems
  115. #ifndef IO_OBJECT_NULL
  116. #define IO_OBJECT_NULL  NULL
  117. #endif
  118.  
  119. #endif